<template>
	<!-- 分类 -->
	<view class="cate-section">
		<view class="cate-item" v-for="(item, index) in cateList" :key="index" @click="handleCateItem(item)">
			<image class="cate-item-img" :src="item.url"></image>
			<text>{{item.text}}</text>
		</view>
	</view>
</template>

<script>
	import url1 from '@/static/temp/c3.png';
	import url2 from '@/static/temp/c5.png';
	import url3 from '@/static/temp/c6.png';
	import url4 from '@/static/temp/c7.png';
	import url5 from '@/static/temp/c8.png';
	export default {
		data() {
			return {
				cateList: [{
						url: url1,
						text: '环球美食'
					},
					{
						url: url2,
						text: '个护美妆'
					},
					{
						url: url3,
						text: '营养保健'
					},
					{
						url: url4,
						text: '家居厨卫'
					},
					{
						url: url5,
						text: '速食生鲜'
					}
				]
			}
		},
		methods: {
			handleCateItem(item) {
				console.log(item.text)
			}
		}
	}
</script>

<style lang="scss" scoped>
	/* 分类 */
	.cate-section {
		display: flex;
		justify-content: space-around;
		align-items: center;
		flex-wrap: wrap;
		padding: 30upx 22upx;
		background: #fff;

		.cate-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			font-size: $font-sm + 2upx;
			color: $font-color-dark;

			/* 原图标颜色太深,不想改图了,所以加了透明度 */
			.cate-item-img {
				width: 88upx;
				height: 88upx;
				margin-bottom: 14upx;
				border-radius: 50%;
				opacity: .7;
				box-shadow: 4upx 4upx 20upx rgba(250, 67, 106, 0.3);
			}
		}
	}

	/* -------------------------------- */

	/* #ifdef MP */
	page {
		.cate-section {
			position: relative;
			z-index: 5;
			border-radius: 16upx 16upx 0 0;
			margin-top: -20upx;
		}
	}

	/* #endif */
</style>
